﻿namespace Sustainalytics.Caching
{
    /// <summary>
    /// Cache item action.
    /// </summary>
    public class AppCacheItemAction
    {
        /// <summary>
        /// Affected cache item.
        /// </summary>
        public AppCacheItem CacheItem { get; set; }

        /// <summary>
        /// Action type.
        /// </summary>
        public AppCacheItemActionType ActionType { get; private set; }


        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="cacheItem"> Cache item. </param>
        /// <param name="actionType"> Action type. </param>
        public AppCacheItemAction(AppCacheItem cacheItem, AppCacheItemActionType actionType)
        {
            if (cacheItem == null)
            {
                throw new CacheItemIsNullException();
            }

            this.CacheItem = cacheItem;
            this.ActionType = actionType;
        }
    }
}
